package com.yigerende.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;



@Configuration
public class WebConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //拿到拦截的页面
        registry.addInterceptor(new LoginInterceptor())
                //url地址admin后面的所有地址都拦截
                .addPathPatterns("/admin/**")
                //下面是排除的路径
                .excludePathPatterns("/admin")
                .excludePathPatterns("/admin/login");
    }
}
